20. Appendix C QSPI programming guide¶
20.1. General¶
This guide describes the methods and tools used for:
- Programming QSPI flash
- Debugging programs which execute from QSPI flash
After programming the QSPI, the image will execute by resetting or power cycling the board.
20.2. Prerequisites¶
Compile the following tools (sources and projects available on SmartSnippets™ DA1468x SDK):
cli_programmer:
Compile
<sdk_root_directory>/utilities/cli_programmer
project.Linux: Use
Debug_static
build configuration in SmartSnippets™ StudioWindows: Compile
cli_programmer.sln
using Visual studio OR use the binaries from SmartSnippets™ DA1468x SDK’sbinaries
folder(
cli_programmer.exe
,libprogrammer.dll
)
bin2image:
Compile
<sdk_root_directory>/utilities/bin2image
project.Linux: Run
make
from project’s folderWindows: Check
README.win32
in project’s folder OR use the binary from SmartSnippets™ DA1468x SDK’sbinaries
folder (bin2image.exe
)
uartboot.bin:
This is the intermediate bootloader that
cli_programmer
uses for communicating with the target.The
uartboot
firmware will automatically detect the device variant. This means that the provideduartboot
binary file does not have to be rebuilt if a different device variant of the DA1468x family is used.Compile
./sdk/bsp/system/loaders/uartboot/
in SmartSnippets™ Studio using the release configuration
Note
cli_programmer
uses uartboot.bin
for communicating with the target.
Copying uartboot.bin to the folder of the cli_programmer
binary will allow cli_programmer
to automatically detect & use uartboot.bin
.
Alternatively, the path to uartboot.bin can be provided to cli_programmer
using -b
commandline option.
Import scripts project into the eclipse workspace in use.
This is needed to starts the cli_programmer
from within SmartSnippets™ Studio IDE
20.3. Compiling for execution from flash¶
SmartSnippets™ DA1468x SDK projects come with SmartSnippets™ Studio build configurations which compile for execution for FLASH (cached) or RAM.
Configuring a project for execution from FLASH/RAM breaks down to the following steps:
- Configure the memory mapping in linker script.
- Using SmartSnippets™ Studio:
- Edit
ldscripts/mem.ld.h
in project’s folder (instructions can be found in file’s header comments). - During project build the
mem.ld
file will be automatically updated.
- Edit
- Not using SmartSnippets™ Studio:
- Edit project’s
ldscripts/mem.ld
file.
- Edit project’s
- Configure project to compile for execution from FLASH.
- In
./sdk/bsp/custom_config_xxx.h
header file, set the macros described below as follows and compile normally:
- For execution from FLASH (cached):
#define dg_configEXEC_MODE MODE_IS_CACHED
#define dg_configCODE_LOCATION NON_VOLATILE_IS_FLASH
- For execution from FLASH (mirrored):
#define dg_configEXEC_MODE MODE_IS_MIRRORED
#define dg_configCODE_LOCATION NON_VOLATILE_IS_FLASH
- For execution from RAM:
#define dg_configCODE_LOCATION NON_VOLATILE_IS_NONE
Note
The BINARY output (<project_name>.bin
, NOT the <project_name>.elf
) will be used in the next steps.
20.4. Flashing an QSPI image¶
Using SmartSnippets™ Studio:
Select the folder which includes <project_name>.bin
(e.g. the project’s Debug folder) and execute one of the following scripts from SmartSnippets™ Studio external tools menu button.
Script name | Notes |
---|---|
Program_qspi_serial_win (Note 1) |
Use this script in case you want to program the selected binary to external QSPI memory using a serial interface. Please follow instructions given on the SmartSnippets™ Studio console window. |
Program_qspi_jtag_win (Note 1) |
Use this script in case you want to program the selected binary to external QSPI memory using the JTAG interface. |
Note
When calling one of these scripts for the first time you will be prompted to enter configuration options. You may change the selected configuration any time using the program_qspi_config_win
script.
Script name | Notes |
---|---|
Program_qspi_serial_linux (Note 1) |
Use this script in case you want to program the selected binary to external QSPI memory using a serial interface. Please follow instructions given on the SmartSnippets™ Studio console window. |
Program_qspi_jtag_linux (Note 1) |
Use this script in case you want to program the selected binary to external QSPI memory using the JTAG interface. |
20.5. Debugging from QSPI¶
20.5.1. General¶
The user may use J-Link SWD interface to attach to the running target & debug, OR reset board & debug as follows:
Using SmartSnippets™ Studio :
The SmartSnippets™ DA1468x SDK includes SmartSnippetsTM Studio launch configurations provided with the SmartSnippets™ DA1468x SDK projects (ATTACH
for attaching to running target and *_qspi.launch
for resetting & attaching to QSPI, RAM for debugging from RAM (where applicable)).
Outside SmartSnippets™ Studio :
The SmartSnippets™ DA1468x SDK includes sample scripts & gdb commands in
utilities/scripts/qspi
folder:
boot_qspi_db*
scripts reset board and put a breakpoint inmain()
. The scripts invoke Jlink gdb server and issue gdb commandsgdb_cmd_qspi*
files are the gdb command files used by the above scripts
Instructions on using these scripts are provided in the next paragraph.
20.5.2. Debugging with gdb scripts¶
- The scripts include references to the executables:
JLinkGDBServerCL
arm-none-eabi-gdb
and can be found in the following SmartSnippets™ DA1468x SDK path:
<sdk_root_directory>/utilities/scripts/qspi
- Make sure that you have the paths to these executables included in
your platform’s system path. If not, edit script files and add the
absolute paths to these executables, for instance in
boo_qspi_dbg.bat
: replace JLinkGDBServerCL.exe with:C:/Program Files/SEGGER/JLink_V512h/JLinkGDBServerCL.exe
- Edit the Debug scripts (
boot_qspi_dbg.*
) and replacePUT_YOUR_APP_ELF_HERE.elf
with the name of the.elf
file you want to debug. This should be the .elf file of the binary image flashed in the QSPI. - Execute the
boot_qspi_dbg.*
script. - The J-Link gdb server running must be operational, connected to
target, downloading & running the boot loader and CPU halting at
main()
breakpoint. After this point a “continue” command can be issued and debug process may proceed, using the same gdb server instance. - Alternatively, it is possible to invoke a second instance of J-Link gdb server and attach it to the target.
Note
Since hardware breakpoints are used, only 4 breakpoints are available.